<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<title>企业管理系统</title>
<meta name="renderer" content="webkit"/>
  <meta name="viewport" content="width=device-width, initial-scale=1"/>
  <link rel="stylesheet" href="layui/css/layui.css" media="all"/>
    <script src="layui/layui.js"></script>
    <!-- jQuery -->
<script src="js/jquery.js"></script>
<!-- jQuery -->
<script src="../plugins/jquery/jquery.min.js"></script>
<script src="js/ajax.js"></script>
  <script>
    //依赖 element 模块，否则无法进行功能性操作
    layui.use('element', function(){
        var element = layui.element;
    });
    function close() {
		if(confirm("您确定要退出登录？")) {
			$.ajax({
				url:"Sp/outlogin",
				type:"post",
				success:function(){
				},
				error:function(){
				}
			})
			window.location.href="/";
		} else {}
	}
    function convertCurrency(money) {
    	  //汉字的数字
    	  var cnNums = new Array('零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖');
    	  //基本单位
    	  var cnIntRadice = new Array('', '拾', '佰', '仟');
    	  //对应整数部分扩展单位
    	  var cnIntUnits = new Array('', '万', '亿', '兆');
    	  //对应小数部分单位
    	  var cnDecUnits = new Array('角', '分', '毫', '厘');
    	  //整数金额时后面跟的字符
    	  var cnInteger = '整';
    	  //整型完以后的单位
    	  var cnIntLast = '元';
    	  //最大处理的数字
    	  var maxNum = 999999999999999.9999;
    	  //金额整数部分
    	  var integerNum;
    	  //金额小数部分
    	  var decimalNum;
    	  //输出的中文金额字符串
    	  var chineseStr = '';
    	  //分离金额后用的数组，预定义
    	  var parts;
    	  if (money == '') { return ''; }
    	  money = parseFloat(money);
    	  if (money >= maxNum) {
    	    //超出最大处理数字
    	    return '';
    	  }
    	  if (money == 0) {
    	    chineseStr = cnNums[0] + cnIntLast + cnInteger;
    	    return chineseStr;
    	  }
    	  //转换为字符串
    	  money = money.toString();
    	  if (money.indexOf('.') == -1) {
    	    integerNum = money;
    	    decimalNum = '';
    	  } else {
    	    parts = money.split('.');
    	    integerNum = parts[0];
    	    decimalNum = parts[1].substr(0, 4);
    	  }
    	  //获取整型部分转换
    	  if (parseInt(integerNum, 10) > 0) {
    	    var zeroCount = 0;
    	    var IntLen = integerNum.length;
    	    for (var i = 0; i < IntLen; i++) {
    	      var n = integerNum.substr(i, 1);
    	      var p = IntLen - i - 1;
    	      var q = p / 4;
    	      var m = p % 4;
    	      if (n == '0') {
    	        zeroCount++;
    	      } else {
    	        if (zeroCount > 0) {
    	          chineseStr += cnNums[0];
    	        }
    	        //归零
    	        zeroCount = 0;
    	        chineseStr += cnNums[parseInt(n)] + cnIntRadice[m];
    	      }
    	      if (m == 0 && zeroCount < 4) {
    	        chineseStr += cnIntUnits[q];
    	      }
    	    }
    	    chineseStr += cnIntLast;
    	  }
    	  //小数部分
    	  if (decimalNum != '') {
    	    var decLen = decimalNum.length;
    	    for (var i = 0; i < decLen; i++) {
    	      var n = decimalNum.substr(i, 1);
    	      if (n != '0') {
    	        chineseStr += cnNums[Number(n)] + cnDecUnits[i];
    	      }
    	    }
    	  }
    	  if (chineseStr == '') {
    	    chineseStr += cnNums[0] + cnIntLast + cnInteger;
    	  } else if (decimalNum == '') {
    	    chineseStr += cnInteger;
    	  }
    	  return chineseStr;
    	}
</script>
  <link rel="stylesheet" href="/layui/a.css"  media="all"/>
  <link rel="stylesheet" href="/layui/b.css" media="all"/>
</head>
<body>
<div class="layui-layout layui-layout-admin">
<div style="background-image: url('/image/toubu2.jpg'); background-size:100% 100% ; background-attachment: fixed;" class="layui-header header header-demo">
  <div class="layui-main">
  <label class="layui-label" style="font-size: 30px;color: white;margin-top: 15px;position: absolute;font-family:华文行楷;">HD海德塑业</label>
    <label class="layui-label" style="position: absolute; left: 40%; margin-top: 10px;font-size: 25px;font-family:STSong;color:white">广西海德企业管理系统</label>
    <ul class="layui-nav">
	  <li class="layui-nav-item">
        <a href="javascript:;"> <i class="layui-icon layui-icon-print"></i><span id="printcount" class="layui-badge" style="margin-right: -10px;">0</span></a>
        <dl id="printstatus" class="layui-nav-child" style="left: auto; right: -22px; text-align: center;">
          <dd>
            <a id="layui-spm-event-aliyun">未打印货单<span class="layui-badge-dot" style="margin-top: -5px;"></span></a>
          </dd>
        </dl>
      </li>
	  <li class="layui-nav-item">
        <a href="javascript:;"> <i class="layui-icon layui-icon-notice"></i><span id="yjcount" class="layui-badge" style="margin-right: -10px;">0</span></a>
        <dl id="zyj" class="layui-nav-child" style="left: auto; right: -22px; text-align: center;">
          <dd>
            <a target="_blank" id="layui-spm-event-aliyun">发货货单逾期告警<span class="layui-badge-dot" style="margin-top: -5px;"></span></a>
          </dd>
        </dl>
      </li>
      <li class="layui-nav-item">
        <a id="quxianname" style="font-size: 18px;" href="javascript:;"><!--<span class="layui-badge-dot" style="left:0; right: auto; margin: -4px 0 0 5px;"></span>--> </a>
        <a id="username" style="font-size: 18px;" href="javascript:;"><!--<span class="layui-badge-dot" style="left:0; right: auto; margin: -4px 0 0 5px;"></span>--> </a>
      </li>
      <li class="layui-nav-item layui-hide-xs">
        <a href="javascript:close();" style="font-size: 18px;">退出登录</span></a>
      </li>
    </ul>
  </div>
</div>
  <div class="layui-side layui-bg-black">
    <div class="layui-side-scroll">
      
<ul class="layui-nav layui-nav-tree site-demo-nav">
  
  <li id="mate" class="layui-nav-item layui-nav-itemed">
    <a class="javascript:;" href="javascript:;">原料系统</a>
    <dl class="layui-nav-child">
      <dd class="">
        <a style="margin-left: 22px;" href="/addmate.html">原料制单</a>
      </dd>
    </dl>
    <dl class="layui-nav-child">
      <dd>
        <a style="margin-left: 22px;" href="/matecon.html">原料管理</a>
      </dd>
    </dl>
  </li>
  
  <li id="sell" class="layui-nav-item layui-nav-itemed">
    <a class="javascript:;" href="javascript:;">货单系统</a>
    <dl class="layui-nav-child">
      <dd class="layui-this">
        <a style="margin-left: 22px;" href="/addsell.html">货单制单</a>
      </dd>
    </dl>
    <dl class="layui-nav-child">
      <dd class="">
        <a style="margin-left: 22px;" href="/sellcon.html">货单管理</a>
      </dd>
    </dl>
    <dl id='fd' class="layui-nav-child">
      <dd class="">
        <a style="margin-left: 22px;" href="/sellcon2.html">废单管理</a>
      </dd>
    </dl>
  </li>
  <li id="stock" class="layui-nav-item">
    <a class="javascript:;" href="javascript:;">库单系统</a>
    <dl class="layui-nav-child">
      <dd id="stock1" class="">
        <a style="margin-left: 22px;" href="/stock.html">库单制单</a>
      </dd>
    </dl>
    <dl class="layui-nav-child">
      <dd class="">
        <a style="margin-left: 22px;" href="/stockGL.html">库单管理</a>
      </dd>
    </dl>
    <dl id="kcxh" class="layui-nav-child">
      <dd class="">
        <a style="margin-left: 22px;" href="/stockXH.html">库单型号</a>
      </dd>
    </dl>
  </li>
  <li id="pay" class="layui-nav-item">
    <a class="javascript:;" href="javascript:;">货款系统</a>
    <dl class="layui-nav-child">
      <dd id="payadd">
        <a style="margin-left: 22px;" href="paycom.html">货款制单</a>
      </dd>
    </dl>
    <dl class="layui-nav-child">
      <dd id="paycon">
        <a style="margin-left: 22px;" href="paycomGL.html">货款管理</a>
      </dd>
    </dl>
  </li>
  <li id="exin" class="layui-nav-item">
    <a class="javascript:;" href="javascript:;">资金系统</a>
    <dl class="layui-nav-child">
      <dd class="">
        <a style="margin-left: 22px;" href="income.html">
          收入制单
        </a>
      </dd>
    </dl>
    <dl class="layui-nav-child">
      <dd class="">
        <a style="margin-left: 22px;" href="incomeGL.html">
          收入管理
        </a>
      </dd>
    </dl>
    <dl class="layui-nav-child">
      <dd class="">
        <a style="margin-left: 22px;" href="expend.html">
          支出制单
        </a>
      </dd>
    </dl>
    <dl class="layui-nav-child">
      <dd class="">
        <a style="margin-left: 22px;" href="expendGL.html">
          支出管理
        </a>
      </dd>
    </dl>
  </li>
  <li id="tj" class="layui-nav-item">
    <a class="javascript:;" href="javascript:;">统计报表</a>
    <dl id="yl" class="layui-nav-child">
      <dd class="">
        <a style="margin-left: 22px;" href="yuanliaoTJ.html">
          原料统计
        </a>
      </dd>
    </dl>
    <dl id="hd" class="layui-nav-child">
      <dd class="">
        <a style="margin-left: 22px;" href="huodanTJ.html">
          货单统计
        </a>
      </dd>
    </dl>
    <dl id="sr" class="layui-nav-child">
      <dd class="">
        <a style="margin-left: 22px;" href="incomeTJ.html">
          收入统计
        </a>
      </dd>
    </dl>
    <dl id="zc" class="layui-nav-child">
      <dd class="">
        <a style="margin-left: 22px;" href="expendTJ.html">
          支出统计
        </a>
      </dd>
    </dl>
    <dl id="qk" class="layui-nav-child">
      <dd class="">
        <a style="margin-left: 22px;" href="qiankuanTJ.html">
          欠款统计
        </a>
      </dd>
    </dl>
    <dl id="kc" class="layui-nav-child">
      <dd class="">
        <a style="margin-left: 22px;" href="kucunTJ.html">
          库单统计
        </a>
      </dd>
    </dl>
  </li>
  <li class="layui-nav-item">
    <a class="javascript:;" href="javascript:;">客户信息</a>
    <dl id="addshopper" class="layui-nav-child">
      <dd>
       <a style="margin-left: 22px;" href="/shopper.html">
          添加客户
        </a>
      </dd>
    </dl>
    <dl id="shopper" class="layui-nav-child">
      <dd class="">
         <a style="margin-left: 22px;" href="/shopperGL.html">
          客户管理
        </a>
      </dd>
    </dl>
  </li>
  <li class="layui-nav-item">
    <a class="javascript:;" href="javascript:;">账号</a>
    <dl id="adduser" class="layui-nav-child">
      <dd>
       <a style="margin-left: 22px;" href="/user.html">
          添加账号
        </a>
      </dd>
    </dl>
    <dl id="user" class="layui-nav-child">
      <dd class="">
         <a style="margin-left: 22px;" href="/userGL.html">
          账号管理
        </a>
      </dd>
    </dl>
    <dl class="layui-nav-child">
      <dd class="">
        <a style="margin-left: 22px;" href="updatepawod.html">
          修改密码
        </a>
      </dd>
    </dl>
    <dl class="layui-nav-child">
      <dd class="">
        <a style="margin-left: 22px;" href="javascript:close();">
          注销
        </a>
      </dd>
    </dl>
  </li>
  
  <li class="layui-nav-item" style="height: 30px; text-align: center"></li>
</ul>

    </div>
  </div>
  <div class="layui-tab layui-tab-brief" lay-filter="demoTitle">
    <div class="layui-body layui-tab-content site-demo site-demo-body">
    
    
      <div class="layui-tab-item layui-show">
        <div class="layui-main">
          <div id="LAY_preview">
<form id="myf" class="layui-form" action="javascript:0;" lay-filter="example" method="post">
  <script>
  	var sum=0;var co=0;
        function addm(){
    		var demoListView = $('#demoList');
    		var demoListViews = $('#demoList2');
		    var name=document.getElementById("name").value;
		    var modele=document.getElementById("modele").value;
		    var quantite=document.getElementById("quantite").value;
		    var unite=document.getElementById("unite").value;
		    var money=document.getElementById("money").value;
		    var total=accMul(money,quantite);
        	if(name==""||quantite==""||money==""){
        		layer.msg("请填写完整货物信息!");
        		return 0;
        	}
        	$.ajax({
				url:"Sp/selestockquantite",
				type:"post",
				data:{
					"modele":modele,
					"quantite":quantite
					},
				dataType:"",
				success:function(a){
					if(!a){
						layer.msg("该型号库存不足!");
					}else{
						var ta =document.getElementById("demoList");
						var trf =document.getElementById("upload2");
						if(trf!=null){
							//document.getElementById("upload2").removeNode();
						}
					    sum=sum+total;
					    document.getElementById("sum").innerHTML=sum;
					    document.getElementById("total").value=sum;
						co++;
						var tr = $(['<tr id="upload1">'
							        ,'<td id="tdname'+co+'" contentEditable="true" style="width: 20%">'+ name +'</td>'
							        ,'<td id="tdmodele'+co+'" style="width: 20%">'+ modele +'</td>'
							        ,'<td id="tdquantite'+co+'" style="width: 10%">'+ quantite +'</td>'
							        ,'<td id="tdunite'+co+'" style="width: 7%">'+ unite +'</td>'
							        ,'<td id="tdmoney'+co+'" style="width: 13%">'+ money +'</td>'
							        ,'<td id="tdtotal'+co+'" style="width: 10%">'+ total +'</td>'
							        ,'<td style="width: 10%">'
							          ,'<button id="tddele'+co+'" class="layui-btn layui-btn-xs layui-btn-danger" value='+total+' onclick="delem(this)">删除</button>'
							          ,'<button id="up" class="layui-btn layui-btn-xs layui-btn-sm" value='+co+'>编辑</button>'
							        ,'</td>','</tr>'
							      ].join(''));
					      demoListView.append(tr);
					      //demoListViews.append(trs);
					}
				},
				error:function(){
					console.log("发生异常");
					
				}
			})
         }
        function info(){
        	var tb=document.getElementById("demoList");
        	var b=new Array(100);
        	var count=0;
        	var rows = tb.rows;
        	for (var i = 0; i < rows.length; i++) {    //--循环所有的行

        	    var cells = rows[i].cells;　　// cells 集合返回表格中所有 <td> 或 <th> 元素。

        	    for (var j = 0; j < cells.length-1; j++) { 
        	        b[count]=cells[j].innerHTML;
        	        count++;
        	    }
        	}
        	
        	$.ajax({
				url:"Sp/ses?b="+b,
				type:"post",
				data:{
					"odd":document.getElementById("odd").value,
					"name2":document.getElementById("name2").value,
           		 "phone":document.getElementById("phone").value,
           		 "site":document.getElementById("site").value,
           		 "anq":document.getElementById("anq").value,
           		 "time":document.getElementById("date").value,
           		 "time2":document.getElementById("date2").value,
           		 /* "debt":document.getElementById("debt").value,*/
           		 "total":document.getElementById("total").value, 
           		 "moneytotal":document.getElementById("moneytotal").value, 
           		 "saisie":document.getElementById("saisie").value, 
           		 /*"saisie":$("#select").find("option:selected").text(),*/
           		 "tupian":document.getElementById("img").value,
           		 "faf":document.getElementById("faf").value
					},
				dataType:"",
				success:function(a){
					layer.msg(a);
					//获取oddmax
				    $.ajax({
				  		url:"oddmax",
				  		type:"get",
				  		dataType:"",
				  		success:function(btn){
				  			document.getElementById('odd').value=btn;
				  		},
				  		error:function(){
				  			console.log("发生异常");
							
				  		}
				  	})
				  	document.getElementById("myf").reset();
				},
				error:function(){
					console.log("发生异常");
					
				}
			})
        	
             /*  $.ajax({  
                 type: "POST",  
                 url: "Sp/ses?b="+b
                		 +"&odd="+document.getElementById("odd").value+
                		 +"&name2="+document.getElementById("name2").value+
                		 +"&phone="+document.getElementById("phone").value+
                		 +"&site="+document.getElementById("site").value+
                		 +"&anq="+document.getElementById("anq").value+
                		 +"&time="+document.getElementById("date").value+
                		 +"&time2="+document.getElementById("date2").value+
                		 +"&saisie="+document.getElementById("saisie").value+
                		 +"&tupian="+document.getElementById("saisie").value+
                		 +"&total="+document.getElementById("total").value
                		 
                		 ,  
                 contentType : 'application/json',  //默认值: "application/x-www-form-urlencoded"，发送信息至服务器时内容编码类型。  
                 success: function (msg) {
              	   alert(msg.value);
                 },error:function(msg){  
                     alert("failed"+msg.value);  
                 },  
        		//data:{"stu":"ssssss"}
                 //data: JSON.stringify(sendInfos)  
             });    */
        	 
        	
        	
        }
        function delem(obj){
        	var tr=obj.parentNode.parentNode;
            var tbody=tr.parentNode;
            tbody.removeChild(tr);
            sum-=obj.value;
		    document.getElementById("sum").innerHTML=sum;
		    document.getElementById("total").value=sum;
        }
        function zhzs(value) {
        	   value = value.replace(/[^\d]/g, '').replace(/^0{1,}/g, '');
        	   if (value != '')
        	      value = parseFloat(value);//.toFixed(3);//小数点
        	   else
        	      value = parseFloat(0);//.toFixed(3);
        	   return value;
        	}
        function numzhengze(value) {
        	if(value=="")
          	   return "";
        	var priceReg = /(^[1-9]\d*(\.\d{1,2})?$)|(^0(\.\d{1,2})?$)/;
        	if (!priceReg.test(value)){

        		layer.msg("请输入正确价格:整数或者保留两位小数")
        	  return "0";
        	}
     	   return value;
        }
        function accMul(arg1,arg2)
        {
        var m=0,s1=arg1.toString(),s2=arg2.toString();
        try{m+=s1.split(".")[1].length}catch(e){}
        try{m+=s2.split(".")[1].length}catch(e){}
        return Number(s1.replace(".",""))*Number(s2.replace(".",""))/Math.pow(10,m)
        }
        function upmoney(value) {
          	var priceReg = /(^[1-9]\d*(\.\d{1,2})?$)|(^0(\.\d{1,2})?$)/;
          	if (!priceReg.test(value)){

          		layer.msg("请输入正确价格:整数或者保留两位小数")
          	   document.getElementById('ototal').value=0;
          	  return "0";
          	}
      	  document.getElementById('ototal').value=accMul(value,document.getElementById('oquantite').value);
       	   return value;
       	}
        function upquantite(value) {//修改时输入数量判断库存还够吗
     	   value = value.replace(/[^\d]/g, '').replace(/^0{1,}/g, '');
     	   if (value != '')
     	      value = parseFloat(value);//.toFixed(3);//小数点
     	   else
     	      value = parseFloat(0);//.toFixed(3);
     	   
        	$.ajax({
				url:"Sp/selestockquantite",
				type:"post",
				data:{
					"modele":document.getElementById('omodele').value,
					"quantite":value
					},
				dataType:"",
				success:function(a){
					if(!a){
						layer.msg("该型号库存不足!");
						document.getElementById('oquantite').value="";
						document.getElementById('ototal').value="";
					}
		        	document.getElementById('ototal').value=accMul(document.getElementById('omoney').value,document.getElementById('oquantite').value);
				},
				error:function(){
					console.log("检查库存发生异常");
					
				}
			})	
	     return value;
       	}
        function Vodd(value) {

     	   value = value.replace(/[^\d]/g, '').replace(/^0{1,}/g, '');
     	   if (value != '')
     	      value = parseFloat(value);//.toFixed(3);//小数点
     	   else
     	      value = parseFloat(0);//.toFixed(3);
        	$.ajax({
				url:"Sp/seleoddbycid",
				type:"post",
				data:{
					"odd":value,
					},
				dataType:"",
				success:function(a){
					if(!a){
						layer.msg("单号已存在");
						document.getElementById("odd").value="";
				     	   return "";
					}
					
				},
				error:function(){
					console.log("发生异常");
					
				}
			})
	     	   return value;
     	}
        function phonezhzs(value) {
        	   value = value.replace(/[^\d]/g, '').replace(/^0{1,}/g, '');
        	   if (value != '')
        	      value = parseFloat(value);//.toFixed(3);//小数点
        	   else
        	      value = parseFloat(0);//.toFixed(3);
        	   
        	   

     	   return value;
        	}
        function inputselect(btn){
            $.ajax({
				url:"Sp/seleshopperbyphone",
				type:"post",
				data:{
					"phone":btn,
					},
				dataType:"",
				success:function(a){
					document.getElementById('name2').value=a.data[0].name;
					document.getElementById('site').value=a.data[0].address;
				},
				error:function(){
					console.log("获取客户详细信息发生异常");
					
				}
			})
        }
</script>
<!-- <div  style="border-left:2px solid #00F;border-bottom:2px solid #00F;border-right:2px solid #00F;">边框开始 -->
	<div class="layui-upload-list">
		<table class="layui-table" id="tabletop">
			 <thead>
			        <tr><th>名称</th>
			        <th>型号</th>
			        <th>数量</th>
			        <th>单位</th>
			        <th>单价</th>
			        <th>合计</th>
			        <th>操作</th>
			      </tr>
			  </thead>     
			  <tbody id="demoList"></tbody>
			  <tbody id="demoList2">
			  <tr><th></th>
			        <th></th>
			        <th></th>
			        <th></th>
			        <th></th>
			        <th><label id="sum">0</label></th>
			        <th></th>
			      </tr></tbody>
		</table>
	</div>	    		 
  
  
  <!-- 布局开始 -->
  <div class="layui-row">
    <div class="layui-col-xs5">
    <fieldset id="top1" class="layui-elem-field layui-field-title">
	  <legend>货物信息</legend>
	</fieldset>
    <div class="layui-form-item">
    <label class="layui-form-label">名称</label>
    <div class="layui-input-block">
      <input type="text" id="name" name="name" lay-reqtext="请输入名称" placeholder="请输入名称" class="layui-input"/>
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">型号</label>
    <div class="layui-input-block">
      <select id="modele" name="modele" lay-search>
      </select>
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">数量</label>
    <div class="layui-input-block">
      <input type="text" id="quantite" name="quantite" onblur="value=zhzs(this.value)" lay-reqtext="请输入数量" placeholder="请输入数量" class="layui-input"/>
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">单位</label>
    <div class="layui-input-block">
      <select id="unite" name="unite">
        <option value="个" selected="selected">个</option>
        <option value="台">台</option>
        <option value="项">项</option>
      </select>
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">单价</label>
    <div class="layui-input-block">
      <input type="text" id="money" name="money" onblur="value=numzhengze(this.value)" lay-reqtext="请输入单价" placeholder="请输入单价" class="layui-input"/>
    </div>
  </div>
  <button type="button" class="layui-btn" onclick="addm()">添加货物</button> 
  
	<div class="layui-upload">
	  <button type="button" class="layui-btn" id="test11">上传图片</button>
	    <img class="layui-upload-img" style="height: 70px;width: 70px" id="demo11">
	    <p id="demoText"></p>
	<input type="hidden" name="img" id="img">
	  <div class="layui-upload-list">
	  </div>
	</div> 
  <!-- </div>边框结束 -->
    
    </div>
    <div class="layui-col-xs7">
    <input type="hidden" id="faf" name="faf" value="add">
      <input type="hidden" id="id" name="id" value="1">
	<fieldset id="top2" class="layui-elem-field layui-field-title">
	  <legend>订单信息</legend>
	</fieldset>
  <div class="layui-form-item">
    <label class="layui-form-label">单号</label>
    <div class="layui-inline">
      <input type="text" id="odd" name="odd" lay-verify="required" onblur="value=Vodd(this.value)" lay-reqtext="请输入单号" placeholder="请输入单号" class="layui-input" disabled="disabled"/>
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">收货人电话</label>
    <div class="layui-inline">
      <input list="greetings" autocomplete="off" onchange="inputselect(this.value)" type="text" id="phone" name="phone" lay-verify="required" onblur="value=phonezhzs(this.value)" lay-reqtext="请输入收货人电话" placeholder="请输入收货人电话" class="layui-input"/>
	    <datalist id="greetings" style="display:none;">
	   </datalist>
    </div>
    <span style="margin-left: 20px; font-size: 15px; margin-right: 10px;">收货人名字</span>
    <div class="layui-inline">
      <!-- <select id="name2" name="name2" lay-filter="name2" lay-verify="required" lay-search>
      </select> -->
      <input type="text" id="name2" name="name2" lay-verify="required" lay-reqtext="请输入收货人名字" placeholder="请输入收货人名字" class="layui-input"/>
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">收货人地址</label>
    <div class="layui-input-block">
      <input type="text" id="site" name="site" lay-verify="required" lay-reqtext="请输入收货人地址" placeholder="请输入收货人地址" class="layui-input"/>
   
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">发货时间</label>
      <div class="layui-inline">
        <input type="text" name="time" id="date" lay-verify="required" lay-reqtext="请选择发货时间" placeholder="请选择发货时间" autocomplete="off" class="layui-input"/>
      </div>
      
    <span style="margin-left: 20px; font-size: 15px; margin-right: 10px;">账期</span>
      <div class="layui-inline">
        <input type="text" name="time2" id="date2" lay-verify="required" lay-reqtext="请选择账期" placeholder="请选择账期" autocomplete="off" class="layui-input"/>
      </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">应收货款</label>
    <div class="layui-inline">
      <input type="text" id="total" name="total" lay-reqtext="添加制单时不需要填写" placeholder="添加制单时不需要填写" disabled="disabled" class="layui-input"/>
    </div>
    <span style="margin-left: 20px; font-size: 15px; margin-right: 10px;">实收货款</span>
    <div class="layui-inline">
      <input type="text" id="moneytotal" value="0" onblur="value=numzhengze(this.value)" name="moneytotal" lay-verify="required" lay-reqtext="" placeholder="" class="layui-input"/>
    </div>
  </div>
   <div class="layui-form-item">
    <label class="layui-form-label">销售人员</label>
    <div class="layui-inline">
      <select id="anq" name="anq" lay-verify="required" lay-search>
      </select>
    </div>
    <!-- <span style="margin-left: 20px; font-size: 15px; margin-right: 10px;">制单人</span>
    <div class="layui-inline">
		<select id="select" name="saisie" lay-search>
		</select>
    </div> -->
    <span style="margin-left: 20px; font-size: 15px; margin-right: 10px;">制单人</span>
    <div class="layui-inline">
      <input type="text" id="saisie" name="saisie" style="background-color: #DCDCDC;" disabled="disabled" class="layui-input"/>
    </div>
  </div>
    
  
  <div class="layui-form-item">
    <div class="layui-input-block">
      <button type="submit" class="layui-btn" lay-submit="" lay-filter="demo1">立即提交</button>
  	<!-- <button type="button" class="layui-btn layui-btn-normal" onclick="info()">立即提交</button>  -->
      <button type="reset" class="layui-btn layui-btn">重置</button>
      <button class="layui-btn layui-btn-primary" onclick="print()"><i class="layui-icon layui-icon-print"></i></button>
    </div>
  </div>
    
    </div>
  </div>
  <!-- 布局结束 -->
  
  
  </form>
<!--   弹出层************************ -->
  <form class="layui-form" id="test" style="display:none">
  <div class="layui-form-item">
    <label class="layui-form-label">名称</label>
    <div class="layui-input-block">
      <input type="text" id="oname" name="oname" lay-reqtext="请输入名称" placeholder="请输入名称" class="layui-input"/>
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">型号</label>
    <div class="layui-input-block">
      <select id="omodele" name="omodele" lay-search>
      </select>
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">数量</label>
    <div class="layui-input-block">
      <input type="text" id="oquantite" name="oquantite" onblur="value=upquantite(this.value)" lay-reqtext="请输入数量" placeholder="请输入数量" class="layui-input"/>
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">单位</label>
    <div class="layui-input-block">
      <select id="ounite" name="ounite">
        <option value="个" selected="selected">个</option>
        <option value="台">台</option>
        <option value="项">项</option>
      </select>
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">单价</label>
    <div class="layui-input-block">
      <input type="text" id="omoney" name="omoney" onblur="value=upmoney(this.value)" lay-reqtext="请输入单价" placeholder="请输入单价" class="layui-input"/>
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">合计</label>
    <div class="layui-input-block">
      <input type="text" id="ototal" name="ototal" disabled="disabled" class="layui-input"/>
    </div>
  </div>
</form>
  
  </div>
  </div>
  </div>
  </div>
  </div>
  <div class="layui-footer footer footer-demo">
  <div class="layui-main">
    <p>
      Build By 广西海德塑料有限责任公司
    </p>
  </div>
</div>
</div>
<div id="LAY_democodejs">
<script>
window.onload=function (){
var strcookie = document.cookie;//获取cookie字符串 
    var arrcookie = strcookie.split("; ");//分割 
    //遍历匹配 
    for ( var i = 0; i < arrcookie.length; i++) { 
	  console.log(arrcookie[i]); 
        var arr = arrcookie[i].split("="); 
        if (arr[0] == "username"){ 
				document.getElementById("saisie").value=arr[1].substring(arr[1].indexOf(":")+1);
		  		document.getElementById("username").innerHTML=arr[1];
        } 
    } 
  if(document.getElementById("username").innerHTML.indexOf("销售")!=-1){
		document.getElementById("mate").style.display="none"; 
		document.getElementById("paycon").style.display="none"; 
		document.getElementById("exin").style.display="none"; 
		document.getElementById("yl").style.display="none"; 
		document.getElementById("sr").style.display="none";
		document.getElementById("zc").style.display="none";
		document.getElementById("stock").style.display="none";  
		document.getElementById("user").style.display="none"; 
		document.getElementById("adduser").style.display="none"; 
		document.getElementById("shopper").style.display="none"; 
		document.getElementById("fd").style.display="none"; 
	}
	if(document.getElementById("username").innerHTML.indexOf("制单")!=-1){
		document.getElementById("exin").style.display="none"; 
		document.getElementById("yl").style.display="none"; 
		document.getElementById("sr").style.display="none";
		document.getElementById("zc").style.display="none";
		document.getElementById("hd").style.display="none";
		document.getElementById("user").style.display="none"; 
		document.getElementById("adduser").style.display="none"; 
		document.getElementById("shopper").style.display="none"; 
		document.getElementById("fd").style.display="none"; 
	}
	if(document.getElementById("username").innerHTML.indexOf("生产")!=-1){
		document.getElementById("mate").style.display="none"; 
		document.getElementById("sell").style.display="none"; 
		document.getElementById("pay").style.display="none"; 
		document.getElementById("exin").style.display="none"; 
		document.getElementById("tj").style.display="none";  
		document.getElementById("sr").style.display="none";
		document.getElementById("zc").style.display="none";
		document.getElementById("user").style.display="none"; 
		document.getElementById("adduser").style.display="none"; 
		document.getElementById("shopper").style.display="none"; 
		document.getElementById("fd").style.display="none"; 
	}
	if(document.getElementById("username").innerHTML.indexOf("超")==-1){
		document.getElementById("kcxh").style.display="none"; 
	}
	$.ajax({
		url:"seleoddalltime",
		type:"post",
		success:function(a){
			console.log(a);
			document.getElementById("yjcount").innerHTML=a.count;
		for(var i= 0;i<a.count;i++){
			var demoListView = $('#zyj')
			var str="<dd lay-unselect> <a id='yj"+i+"' href='"+a.href[i]+"'>逾期告警<span class='layui-badge-dot' style='margin-top: -5px;'></span></a></dd>"
			
	          demoListView.append(str);
			document.getElementById('yj'+i).innerHTML=a.str[i];	
		}			
		},
		error:function(){
			console.log("逾期告警发生异常");
		}
	})
	$.ajax({
		url:"Sp/seleprintstatus",
		type:"post",
		success:function(a){
			console.log(a);
			document.getElementById("printcount").innerHTML=a.count;
		for(var i= 0;i<a.count;i++){
			var demoListView = $('#printstatus')
			var str="<dd lay-unselect> <a id='dyyj"+i+"' href='"+a.href[i]+"'>逾期告警<span class='layui-badge-dot' style='margin-top: -5px;'></span></a></dd>"
			
	          demoListView.append(str);
			document.getElementById('dyyj'+i).innerHTML=a.string[i];	
		}			
		},
		error:function(){
			console.log("打印告警发生异常");
			
		}
	})
}

function print() {
	var id=document.getElementById('id').value;
	if(id!=1){
		$.ajax({
			url:"Sp/printstatus",
			type:"post",
			data:{id:id},
			success:function(){
			},
			error:function(){
				console.log("发生异常");
				
			}
		})
	}
	demoListView = $('#upload1');
	if(demoListView.length==0){
		layer.msg("请添加货物");
		return 0;
	}
	var time1 =document.getElementById('date').value;
	time1=time1.substring(0,10);
	var a=document.getElementById("tabletop").rows.length;
	 var html="";
	//html+="<table class="layui-table"><thead><tr><th>名称</th><th>型号</th><th>数量</th><th>单位</th><th>单价</th><th>合计(<label id='sum'></label>)</th></tr></thead></table>";
	//html+=document.getElementById("top2").innerHTML;
	//html+="<br/><label>单号："+document.getElementById('odd').value+"</label><br/><br/>";
	//html+="<label>收货人："+document.getElementById('name2').value+"</label><br/><br/>";
	//html+="<label>收货人电话："+document.getElementById('phone').value+"</label><br/><br/>";
	//html+="<label>收货人地址："+document.getElementById('site').value+"</label><br/><br/>";
	//html+="<label>销售人员："+document.getElementById('anq').value+"</label><br/><br/>";
	//html+="<label>发货时间："+document.getElementById('date').value+"</label><br/><br/>";
	//html+="<label>收货人："+document.getElementById('date2').value+"</label><br/><br/>";
	//html+="<label>收货人："+document.getElementById('saisie').value+"</label><br/><br/>";
	//html+=document.getElementById("top1").innerHTML;
	html+="<h1 style='text-align:center;font-size: 22px;'>广西海德塑业销售出库单</h1>";
	html+="<div style='margin-left: 20px;margin-top: 20px;'><div style='float: left;'><label>客户名称："+document.getElementById('name2').value+"</label><br/>"
	html+="<label>客户地址："+document.getElementById('site').value+"</label></div>"
	html+="<div style='float: right;margin-right: 70px;'><label>单号："+document.getElementById('odd').value+"</label><br/>";
	html+="<label>日期："+time1+"</label></div></div>";
	//html+="<table class='layui-table'><colgroup><col width='120'><col width='220'><col width='80'><col width='80'><col width='100'><col width='100'><col></colgroup><thead><tr style='border: 1px solid black;'><th>名称</th><th>型号</th><th>单位</th><th>数量</th><th>单价</th><th>金额</th></tr> </thead><tbody>";
	html+="<div style='margin-left: 20px;margin-top:80px;'><table style='border: 1px solid black;width: 95%;' class='layui-table'><tr style='border: 1px solid black;height: 25px;'><th>名称</th><th>型号</th><th>单位</th><th>数量</th><th>单价</th><th>金额</th></tr>";
	var num=0;var ic=0,count=10;
	if(document.getElementById('faf').value=="add"){
		count=11;ic=1;
	}
	for (var i = ic; i < count; i++) {
		var name="tdname"+i;
		var modele="tdmodele"+i;
		var quantite="tdquantite"+i;
		var unite="tdunite"+i;
		var money="tdmoney"+i;
		var total="tdtotal"+i;
		if($("#"+quantite).text()!="")
		num+=parseInt($("#"+quantite).text());
		html+="<tr style='border: 1px solid black;height: 25px;'><th>"+
		$("#"+name).text()+"</th><th>"+
		$("#"+modele).text()+"</th><th>"+
		$("#"+unite).text()+"</th><th>"+
		$("#"+quantite).text()+"</th><th>"+
		$("#"+money).text()+"</th><th>"+
		$("#"+total).text()+"</th></tr>";
		}
		html+="<tr style='border: 1px solid black;height: 25px;'><td>合计</td><td colspan='2'>"+convertCurrency($('#sum').text())+"</td><td>"+num+"</td><td></td><td>"+$('#sum').text()+"</td></tr></table></div>"
		
		html+="<div style='margin-left: 20px;font: 20px;'><div style='float: left;'><label>收货人："+document.getElementById('name2').value+"</label><br/>"
		//html+="<label>联系电话："+document.getElementById('phone').value+"</label><br/>";
		html+="<label>应收货款："+document.getElementById('total').value+"</label><br/>";
		html+="<label style='position: fixed;'>厂家电话：18074938195卢总</label><br/>";
		html+="<label style='position: fixed;'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;15277248778韦经理</label></div>";
		
		
		html+="<div style='float: left;margin-left: 90px;'><label>联系电话："+document.getElementById('phone').value+"</label><br/>"
		html+="<label>实收货款："+document.getElementById('moneytotal').value+"</label></div>";
		
		
		
		html+="<div style='float: right;margin-right: 70px;'><label>销售员："+document.getElementById('anq').value+"</label><br/>"
		html+="<label>制单员："+$('#select option:selected').val()+"</label><br/><br/><label>签收人：</label></div></div>";
		
	var v = document.createElement("div"); 
    var f = ["<head>", "<style>","<link rel='stylesheet' href='/layui/a.css' media='all'/>","<link rel='stylesheet' href='/layui/b.css' media='all'/>", "body{font-size: 10px; color: black;}", "table{width: 100%; border-collapse: collapse; border-spacing: 0;}", "th,td{line-height: 20px; padding: 4px 15px; border: 1px solid black; text-align: left; font-size: 8px; color: black;}", "a{color: black; text-decoration:none;}", "*.layui-hide{display: none}",".picture{ }", "</style>", "</head>"].join("");
    //var f = ["<head>", "<style>", "body{font-size: 12px; color: #666;}", "table{width: 100%; border-collapse: collapse; border-spacing: 0;}", "th,td{line-height: 20px; padding: 9px 15px; border: 1px solid #ccc; text-align: left; font-size: 12px; color: #666;}", "a{color: #666; text-decoration:none;}", "*.layui-hide{display: none}",".picture{ }", "</style>", "</head>"].join("");
    $(v).append($("#table_info").html()+"</div>");
    var h = window.open("Print_window", "_blank");
    h.document.write(f+html);
    h.document.close();
    h.print();
    h.close(); 
    location.reload();
}
layui.use(['layer','form', 'layedit', 'laydate'], function(){
  var form = layui.form
  ,layer = layui.layer
  ,layedit = layui.layedit
  ,laydate = layui.laydate;
  
  //监听提交
   form.on('submit(demo1)', function(data){
	   demoListView = $('#upload1');
	if(demoListView.length==0){
		layer.msg("请添加货物");
	}else{
		info();
	}
	   /* $.ajax({
			url:"Sp/addsell",
			type:"post",
			data:data.field,
			dataType:"",
			success:function(a){
				layer.alert(a.result);
			},
			error:function(){
				alert("发生异常");
			}
		})
    return false; */
  }); 
  $(document).on('click',"#up",function(data){
	  var n=this.value;
	  console.log(this);
	  console.log(document.getElementById('tdname'+n));
	  document.getElementById('oname').value=document.getElementById('tdname'+n).innerHTML;
	  document.getElementById('omodele').value=document.getElementById('tdmodele'+n).innerHTML;
	  document.getElementById('omoney').value=document.getElementById('tdmoney'+n).innerHTML;
	  document.getElementById('oquantite').value=document.getElementById('tdquantite'+n).innerHTML;
	  document.getElementById('ounite').value=document.getElementById('tdunite'+n).innerHTML;
	  document.getElementById('ototal').value=accMul(document.getElementById('oquantite').value,document.getElementById('omoney').value);
	   var total=document.getElementById('ototal').value;
	   var sum2 =0;
	  layer.open({
		  type:1,
		  area:['600px','450px'],
		   title: '货物信息'
		   ,content: $("#test"),
		   shade: 0,
		   btn: ['提交']
		   ,btn1: function(index, layero){
			   sum2=parseInt(document.getElementById('sum').innerHTML);
			   sum2+= parseInt(document.getElementById('ototal').value);//先加
			   sum2-=total;//再减
			   if(sum2<document.getElementById("moneytotal").value){
				   
				   layer.msg("货物合计不可低于实收货款");
			   }else{
				   document.getElementById('sum').innerHTML=sum2;//再赋值回去
				   document.getElementById('tdname'+n).innerHTML=document.getElementById('oname').value;
				   document.getElementById('tdmodele'+n).innerHTML=document.getElementById('omodele').value;
				   document.getElementById('tdmoney'+n).innerHTML=document.getElementById('omoney').value;
				   document.getElementById('tdquantite'+n).innerHTML=document.getElementById('oquantite').value;
				   document.getElementById('tdunite'+n).innerHTML=document.getElementById('ounite').value;
				   document.getElementById('tdtotal'+n).innerHTML=document.getElementById('ototal').value;
				   document.getElementById('tddele'+n).value=document.getElementById('ototal').value;
				   
				    document.getElementById("total").value=sum2;
					sum=sum2;
					layer.closeAll();
			   }
		   },
		 cancel: function(layero,index){ 
		    layer.closeAll();
		   }

		 }); 
	  });
 //获取客户select
  $.ajax({
		url:"Sp/seleallshopper",
		type:"post",
		dataType:"",
		success:function(btn){
	          var select = $("#greetings");//TypeID为HTML标签ID
		      	for (var j = 0; j < btn.count; j++) {
			      	  select.append("<option value='"+btn.data[j].phone+"'>"+btn.data[j].name+"</option>");
		  		}
				//document.getElementById('phone').value=btn.data[0].phone;
				//document.getElementById('site').value=btn.data[0].address;
	          layui.form.render("select");
		},
		error:function(){
			layer.msg("客户获取失败");
		}
	})
	 //获取型号select
	  $.ajax({
			url:"seleallstockbymodele",
			type:"post",
			dataType:"",
			success:function(btn){
		          var select = $("#modele");//TypeID为HTML标签ID
		          var selectopen = $("#omodele");//TypeID为HTML标签ID
		          select.append("<option value='运费'>运费</option>");
		          selectopen.append("<option value='运费'>运费</option>");
			      	for (var j = 0; j < btn.count; j++) {
				      	  select.append("<option value='"+btn.data[j]+"'>"+btn.data[j]+"[剩余"+btn.num[j]+"]</option>");
				      	selectopen.append("<option value='"+btn.data[j]+"'>"+btn.data[j]+"[剩余"+btn.num[j]+"]</option>");
			  		}
		          layui.form.render("select");
			},
			error:function(){
				layer.msg("型号获取失败");
			}
		})
 //获取销售select
   $.ajax({
		url:"Sp/seleallanq",
		type:"post",
		dataType:"",
		success:function(btn){
	          var select = $("#anq");//TypeID为HTML标签ID
		      	for (var j = 0; j < btn.count; j++) {
		      	  select.append("<option value='"+btn.data[j]+"'>"+btn.data[j]+"</option>");
		  		}
	          layui.form.render("select");
		},
		error:function(){
			layer.msg("人员获取失败");
		}
	})
	//获取zhidan员select
	   $.ajax({
	 		url:"Sp/seleallzhidan",
	 		type:"post",
	 		dataType:"",
	 		success:function(btn){
	 	          var select = $("#select");//TypeID为HTML标签ID
	 		      	for (var j = 0; j < btn.count; j++) {
	 		      	  select.append("<option value='"+btn.data[j]+"'>"+btn.data[j]+"</option>");
	 		  		}
	 	          layui.form.render("select");
	 		},
	 		error:function(){
	 			console.log("发生异常");
				
	 		}
	 	})
	 	
	 	
	 	var url = location.search;  
	if (url.indexOf("?") == -1) { 
		//获取oddmax
	    $.ajax({
	  		url:"oddmax",
	  		type:"get",
	  		dataType:"",
	  		success:function(btn){
	  			document.getElementById('odd').value=btn;
	  		},
	  		error:function(){
	  			console.log("发生异常");
				
	  		}
	  	})
	}
	 	
		
	//日期
  laydate.render({
    elem: '#date',
    type: 'datetime'
  });
  laydate.render({
	    elem: '#date2',
	    type: 'date'
	  });

	var url = location.search;  
	if (url.indexOf("?") != -1) {
	  var str = url.substr(1);  
		$('#moneytotal').attr("disabled","disabled");    
	}

	//编辑后给表单赋值
	if(url!=null&&url!=""){
		$.ajax({
			url:"Sp/oddone",
			type:"get",
			data:{"odd":str},
			dataType:"",
			success:function(a){
				document.getElementById('img').value=a.tupian;
				document.getElementById('demo11').src="/Sp/gettu?name="+a.tupian;
		    	  //$('#demo11').attr('src', result); //图片链接（base64）
				//表单赋值
			    form.val('example', {
			      "id": a.id
				  ,"time": a.time
				  ,"time2": a.time2
				  ,"anq": a.anq
				  ,"site": a.site
				  ,"phone": a.phone
				  ,"odd": a.odd
				  ,"name2": a.name2
			      ,"saisie": a.saisie
			      ,"total": a.total
			      ,"moneytotal": a.total-a.debt
			      ,"faf": "up"
			    });
			     $.ajax({
					url:"Sp/xinsellone",
					data:{"odd":str},
					type:"get",
					dataType:"",
					success:function(a){
			    		var demoListView = $('#demoList')
						
    				for (var j = 0; j < a.length; j++) {
    					sum+=accMul(a[j].quantite,a[j].money);
						var tr = $(['<tr id="upload1">'
							        ,'<td id="tdname'+j+'" contentEditable="true" style="width: 20%">'+ a[j].name +'</td>'
							        ,'<td id="tdmodele'+j+'" style="width: 20%">'+ a[j].modele +'</td>'
							        ,'<td id="tdquantite'+j+'" style="width: 10%">'+ a[j].quantite +'</td>'
							        ,'<td id="tdunite'+j+'" style="width: 7%">'+ a[j].unite +'</td>'
							        ,'<td id="tdmoney'+j+'" style="width: 13%">'+ a[j].money +'</td>'
							        ,'<td id="tdtotal'+j+'" style="width: 10%">'+ accMul(a[j].quantite,a[j].money) +'</td>'
							        ,'<td style="width: 10%">'
							          ,'<button id="tddele'+j+'" class="layui-btn layui-btn-xs layui-btn-danger" value='+a[j].money+' onclick="delem(this)">删除</button>'
							          ,'<button id="up" class="layui-btn layui-btn-xs layui-btn-sm" value='+j+'>编辑</button>'
							        ,'</td>'
							      ,'</tr>'].join(''));
							      
							      demoListView.append(tr);
    				}
					    document.getElementById("sum").innerHTML=sum;
					    document.getElementById("total").value=sum;
					},
					error:function(){
						if(str==null||str==""){
							
						}else
							console.log("xinsell发生异常");
					}
				}) 
			},
			error:function(){
				if(str==null||str==""){
					
				}else
					layer.msg("odd发生异常");
			}
		})
	
	}
});



layui.use('upload', function(){
	  var $ = layui.jquery
	  ,upload = layui.upload;

	  var timestamp = Date.parse(new Date());//获取时间戳
	//普通图片上传
	  var uploadInst = upload.render({
	    elem: '#test11'
	    ,url: 'Sp/upload' //改成您自己的上传接口
	    , data: {name: timestamp}
	    ,before: function(obj){
	      //预读本地文件示例，不支持ie8
	      obj.preview(function(index, file, result){
		    	console.log(file);
		    	document.getElementById('img').value=timestamp+"@"+file.name;
	    	  $('#demo11').attr('src', result); //图片链接（base64）
	      });
	    }
	    ,done: function(res){
	      //如果上传失败
	      if(res.code > 0){
	        //return layer.msg('上传失败');
	      }else{}
	      //上传成功
	    }
	  });
});


</script>
</div>
</body>
</html>